<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script src="./lib/vue_2.5.22.js"></script>
    <script src="./lib/vue-router_3.0.2.js"></script>
</head>

<body>
    <div id="app">
        <router-link to="/user">User</router-link>
        <router-link to="/register">Register</router-link>
        <router-view></router-view>
    </div>

    <script>
        const User = {
            template: '<h1>User 组件</h1>'
        }

        const Register = {
            template: '<h1>Register 组件</h1>'
        }

        const router = new VueRouter({
            routes: [{
                path: '/',
                component: Register
            }, {
                path: '/user',
                component: User
            }, {
                path: '/register',
                component: Register
            }]
        })

        const vm = new Vue({
                el: '#app',
                data: {},
                router
            })
            // 需求1: 打开网页的时候, 就默认的跳转到 /register 去
            // 需求2: 将路由重定向到 /abc, 看看效果, 能不能重定向? 说明了什么问题
    </script>
</body>

</html>